package com.xyht.medicine_management_system.auth.aop;

import com.alibaba.fastjson.JSON;
import lombok.extern.log4j.Log4j2;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Aspect
@Component
@Log4j2
@Order(1)
public class TestAop {
    @Resource
    private HttpServletRequest request;

    public TestAop(HttpServletRequest request) {
        this.request = request;
    }

    @Pointcut("@annotation(com.xyht.medicine_management_system.auth.annotation.TestAnnotation)")
    private void testPointcut(){
    }

    @Before("testPointcut()")
    public void permissionCheckFirst(){
        log.debug("===================第一个切面===================：");
        log.debug("+++++++++++"+request.getHeader("abc"));
    }


}
